<!--conf
<sample>
              <product version="1.4" edition="pro"/>
                     <modifications>
                            <modified date="070101"/>
                     </modifications>
               </sample>
 --> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>Date/Decimal format</title>

		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
</head>
<body>
	<h1>Date/Decimal format</h1>
	<p>You can set Date and Decimal number formats using <code>setDateFormat</code> and <code>setNumberFormat</code> methods</p>
		<div id="gridbox" style="width:452px;height:215px;background-color:white;"></div>
    <script>
        //extended simple editor (with number format support) to use color for numbers
		function eXcell_edncl(cell){
			this.base = eXcell_edn;
			this.base(cell)
			this.setValue = function(val){
					if(!val || val.toString()._dhx_trim()=="")
						val="0"
					if(val>=0)
						this.cell.style.color = "green";
					else
						this.cell.style.color = "red";
					this.cell.innerHTML = this.grid._aplNF(val,this.cell._cellIndex);
			}
		
		}
		eXcell_edncl.prototype = new eXcell_edn;
		
		//extended simple editor (with number format support) to be readonly
		function eXcell_ednro(cell){
			this.base = eXcell_edn;
			this.base(cell)
			this.isDisabled=function(){
				return true;
			}
			this.edit = function(){
				return false;
			}
			this.detach = function(){
				return false;
			}
		}
		eXcell_ednro.prototype = new eXcell_edn;
    </script>



<script>
	mygrid = new dhtmlXGridObject('gridbox');
	mygrid.setImagePath("../../../codebase/imgs/");
	mygrid.setHeader("N.format colored,N.format readonly, Date");
	mygrid.setInitWidths("100,100,100")
	mygrid.setColAlign("right,right,right")
	mygrid.setColTypes("edncl,ednro,dhxCalendar");
    mygrid.setNumberFormat("$0,000",0);
    mygrid.setNumberFormat("@000.00Zbh",1);
	mygrid.setDateFormat("%m-%d-%Y") 
	mygrid.setColSorting("int,int,date")
	mygrid.enableAutoWidth(true);
	mygrid.init();
	mygrid.setSkin("dhx_skyblue")
	mygrid.loadXML("../common/grid_format.xml");
</script>

</body>
</html>
